{{extend "layout.html"}}
<div id='home'>
{{=H2(module_name)}}
{{if groups_problems:}}
  {{for group, latest_problems, actions in groups_problems:}}
    {{if actions:}}
      <div id='delphi_problem_header'>
      {{for action in actions:}}
        <a href='{{=URL(action[0])}}'>{{=T(action[1])}}</a>
      {{pass}}
      </div>
    {{pass}}
    {{=H3(group.name)}}
    {{if group.description:}}
        <p>{{=group.description}}</p>
    {{pass}}
    {{if latest_problems:}}
    <ul style='margin: 5px 30px 10px;'>
        {{for pr in latest_problems:}}
          {{ k = pr.delphi_solution.select() and len(pr.delphi_solution.select()[0].delphi_vote.select(db.delphi_vote.user_id, distinct=True)) or 0 }}
            <li><a href='{{=URL(f="summary", args=pr.id) }}'><b>{{=pr.name}}</b> ({{=k}} {{=T("Vote") if k == 1 else T("Votes")}})</a>
            {{if pr.description:}}
                <p>{{=pr.description}}</p>
            {{pass}}
            </li>
        {{pass}}
    </ul>
    {{pass}}
    <br />
{{pass}}
{{else:}}
    {{=H3(T("No problem group defined yet"))}}
{{pass}}
</div>
